//
//  CJRootViewController.swift
//  SwiftStudy
//
//  Created by WXC on 2017/9/21.
//  Copyright © 2017年 jiaoyin. All rights reserved.
//

import UIKit
let cellID = "cellID"
class CJRootViewController: UITableViewController {
    let arr:NSArray = {return ["1","2","2","2","2","2"]}()
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.title = NSStringFromClass(CJRootViewController.self)
        tableView.tableFooterView = UIView()
        tableView.register(UINib.init(nibName: "CJRootViewCell", bundle: nil), forCellReuseIdentifier: cellID)
        tableView.rowHeight = 44
    }
}

// MARK: - Table view data source
extension CJRootViewController {
    override func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return arr.count
    }
    
     override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: cellID, for: indexPath) as! CJRootViewCell
        cell.contentLab.text = arr[indexPath.row] as? String
        return cell
     }

}

// MARK: - Table view data delegate
extension CJRootViewController {
    
    override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0 )
    }
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        print("xuanzhong..........")
    }

}
